<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class NewAdmin extends Model
{
    use HasFactory;

    protected $table = 'sp_other_admin';
    protected $primaryKey = 'id';
    public $timestamps = false;

    //type账号类型  1.管理后台2供应商后台
    const OTHER_ADMIN_TYPE_PLATFORM = 1;//管理后台
    const OTHER_ADMIN_TYPE_SHOPER = 2;//供应商后台

    //status状态；0禁用1正常
    const OTHER_ADMIN_STATUS_ENABLE = 1;//正常
    const OTHER_ADMIN_STATUS_DISABLE = 0;//禁用

    //查询管理员信息
    protected function GetNewAdminById($id)
    {
        $where = array(
            'id' => $id,
        );
        $data = $this
            ->where($where)
            ->first();
        $data = $data ? $data->toArray() : array();
        return $data;
    }

    protected function editNewAdmin($where, $data)
    {
        return $data = $this->where($where)->update($data);
    }

    protected function getOneNewAdmin($where)
    {
        $data = $this
            ->where($where)
            ->first();
        $data = $data ? $data->toArray() : array();
        return $data;
    }


}
